-- card: 37512 from stack: in.2r -- bmap block id: 0 -- flags: 0000 -- background id: 3837 -- name: ReadCat -- part contents for background part 5 ----- text ----- ReadCat -- part contents for background part 6 ----- text ----- The ReadCat XFCN Version 1.5b2 will give you handy access to much of the information in the floppy disk catalogs to use as you see fit in your stacks. You may display the catalog brazenly as I do in my stack, AutoCat 4.0, or you may elect to protect your users from this unpleasantness by using the information as a skeleton for fancy graphic representations. This XFCN is entirely in the public domain. You are encouraged to use it in your own stacks, but take note that while it has been tested thoroughly, it is not guaranteed error free. Please do not sell the XFCN, and please credit me (my only reward) when you use it in your stacks. Also recommended is Auto Floppy Log 3.5 , a HyperCard Disk Catalog. Available on CompuServe in the HyperCard Forum in DL8 as well as elsewhere in the public domain. Oscar F. Hills 34 Maplewood Terrace Hamden, CT 06514 (203) 287-1913 CIS => 73317, 3005 GEnie => O.HILLS For your information, the ReadCat XFCN requires the following three resources to be installed in your stack (done automatically by the button below): DLOG "ReadCat" ID = 18367 DITL "ReadCat" ID = 8207 XFCN "ReadCat" ID = 32 -- part contents for background part 7 ----- text ----- Syntax: ReadCat() ex: "put ReadCat() into catbox." This will cause HyperCard to prompt the user to insert a floppy disk which will then be read. The catalog will end up in the variable "catbox" or any other container, in the following format: Line 1: The Volume Name of The Floppy Disk Lines 2 to (The Number of Files and Folders on The Disk): There will be seven comma delimited items in each line as follows: Item 1: Will be either "File" or "Fldr" depending on which it is. Item 2: Will contain the short Date Last Modified of the file. Item 3: The Size of the File in KiloBytes. Item 4: The File Name. Item 5: The Directory ID number (see below). Item 6: The Parent ID number (Yup, parents too, see below). Item 7: The File Type, like "APPL", "TEXT", "STAK" -ID Numbers - Every file and folder has its own ID number. The so-called root directory, i.e., the disk itself, always has an ID number of 2. Every file and folder also has a Parent ID number, and this is the same as the ID number of the folder which contains the particular file or folder. If it is sitting directly on the disk, then the Parent ID number is 2. These numbers can help you reconstruct the catalog hierarchy (by the way, under MFS the Parent ID number is always 2), but it is probably wise to prevent your users from actually seeing this sort of thing. - put ReadCat(1) into catbox- What if you just want to know what's on the disk? Using the parameter 1 in the ReadCat XFCN will cause just the file names to be placed into the specified container. The first line will still contain the volume name, however. - put ReadCat(2) into dummy- Usually, you will wish to place the information returned by the ReadCat XFCN into fields in your stack. Having to extract this information item by item in order to apportion it into the proper fields can be very time consuming in HyperTalk. Using the parameter 2 in the ReadCat XFCN results in the variable being returned empty. The good news is that the ReadCat XFCN will try to place each catalog item into eight background fields on the card which calls it. You must create these fields first, and name them exactly as follows: Volume Object Type Date Size File Name Directory ID Parent ID File Type These background fields will then contain the information as described above. The field "Volume" will contain the disk's name, and the other background fields, which should probably be scrolling fields if they are to be visible, will contain lists of each of the other seven items described earlier. - put ReadCat(2,0,0,0,0,0,0,0,0) into dummy- Now, of course, you may not wish to waste time and space storing information you do not need. In this case, the parameter 2 may be accompanied by eight additional parameters. Each of these represents one of the eight background fields described above. A zero will cause the field to be ignored (you wouldn't even need to create the background field) while a 1 will cause the appropriate information to be placed into the background field. For example, if you wished the function to return only the Date Last Modified, the File Size, and the File Name to those fields you would use the line "put ReadCat(2,0,0,1,1,1,0,0,0) into dummy." -- part contents for background part 10 ----- text ----- 42